home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / CIncludes / Fonts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-29  |  6.3 KB  |  272 lines  |  [TEXT/MPS ]

  1.  
  2. /************************************************************
  3.  
  4. Created: Tuesday, September 17, 1991 at 12:58 PM
  5.  Fonts.h
  6.  C Interface to the Macintosh Libraries
  7.  
  8.  
  9.   Copyright Apple Computer, Inc. 1985-1991
  10.   All rights reserved
  11.  
  12. ************************************************************/
  13.  
  14.  
  15. #ifndef __FONTS__
  16. #define __FONTS__
  17.  
  18. #ifndef __TYPES__
  19. #include <Types.h>
  20. #endif
  21.  
  22.  
  23. enum {
  24.  
  25.  systemFont = 0,
  26.  applFont = 1,
  27.  newYork = 2,
  28.  geneva = 3,
  29.  monaco = 4,
  30.  venice = 5,
  31.  london = 6,
  32.  athens = 7,
  33.  sanFran = 8,
  34.  toronto = 9,
  35.  cairo = 11,
  36.  losAngeles = 12,
  37.  times = 20,
  38.  helvetica = 21,
  39.  courier = 22,
  40.  symbol = 23,
  41.  mobile = 24,
  42.  commandMark = 17,
  43.  checkMark = 18,
  44.  diamondMark = 19
  45. };
  46. enum {
  47.  appleMark = 20,
  48.  propFont = 36864,
  49.  prpFntH = 36865,
  50.  prpFntW = 36866,
  51.  prpFntHW = 36867,
  52.  fixedFont = 45056,
  53.  fxdFntH = 45057,
  54.  fxdFntW = 45058,
  55.  fxdFntHW = 45059,
  56.  fontWid = 44208
  57. };
  58.  
  59. struct FMInput {
  60.  short family;
  61.  short size;
  62.  Style face;
  63.  Boolean needBits;
  64.  short device;
  65.  Point numer;
  66.  Point denom;
  67. };
  68.  
  69. typedef struct FMInput FMInput;
  70.  
  71. struct FMOutput {
  72.  short errNum;
  73.  Handle fontHandle;
  74.  unsigned char boldPixels;
  75.  unsigned char italicPixels;
  76.  unsigned char ulOffset;
  77.  unsigned char ulShadow;
  78.  unsigned char ulThick;
  79.  unsigned char shadowPixels;
  80.  char extra;
  81.  unsigned char ascent;
  82.  unsigned char descent;
  83.  unsigned char widMax;
  84.  char leading;
  85.  char unused;
  86.  Point numer;
  87.  Point denom;
  88. };
  89.  
  90. typedef struct FMOutput FMOutput;
  91. typedef FMOutput *FMOutPtr;
  92.  
  93. struct FontRec {
  94.  short fontType;        /*font type*/
  95.  short firstChar;        /*ASCII code of first character*/
  96.  short lastChar;        /*ASCII code of last character*/
  97.  short widMax;            /*maximum character width*/
  98.  short kernMax;            /*negative of maximum character kern*/
  99.  short nDescent;        /*negative of descent*/
  100.  short fRectWidth;        /*width of font rectangle*/
  101.  short fRectHeight;        /*height of font rectangle*/
  102.  short owTLoc;            /*offset to offset/width table*/
  103.  short ascent;            /*ascent*/
  104.  short descent;            /*descent*/
  105.  short leading;            /*leading*/
  106.  short rowWords;        /*row width of bit image / 2 */
  107. };
  108.  
  109. typedef struct FontRec FontRec;
  110.  
  111. struct FMetricRec {
  112.  Fixed ascent;            /*base line to top*/
  113.  Fixed descent;            /*base line to bottom*/
  114.  Fixed leading;            /*leading between lines*/
  115.  Fixed widMax;            /*maximum character width*/
  116.  Handle wTabHandle;        /*handle to font width table*/
  117. };
  118.  
  119. typedef struct FMetricRec FMetricRec;
  120.  
  121. struct WidEntry {
  122.  short widStyle;        /*style entry applies to*/
  123. };
  124.  
  125. typedef struct WidEntry WidEntry;
  126.  
  127. struct WidTable {
  128.  short numWidths;        /*number of entries - 1*/
  129. };
  130.  
  131. typedef struct WidTable WidTable;
  132.  
  133. struct AsscEntry {
  134.  short fontSize;
  135.  short fontStyle;
  136.  short fontID;            /*font resource ID*/
  137. };
  138.  
  139. typedef struct AsscEntry AsscEntry;
  140.  
  141. struct FontAssoc {
  142.  short numAssoc;        /*number of entries - 1*/
  143. };
  144.  
  145. typedef struct FontAssoc FontAssoc;
  146.  
  147. struct StyleTable {
  148.  short fontClass;
  149.  long offset;
  150.  long reserved;
  151.  char indexes[48];
  152. };
  153.  
  154. typedef struct StyleTable StyleTable;
  155.  
  156. struct NameTable {
  157.  short stringCount;
  158.  Str255 baseFontName;
  159. };
  160.  
  161. typedef struct NameTable NameTable;
  162.  
  163. struct KernPair {
  164.  char kernFirst;        /*1st character of kerned pair*/
  165.  char kernSecond;        /*2nd character of kerned pair*/
  166.  short kernWidth;        /*kerning in 1pt fixed format*/
  167. };
  168.  
  169. typedef struct KernPair KernPair;
  170.  
  171. struct KernEntry {
  172.  short kernLength;        /*length of this entry*/
  173.  short kernStyle;        /*style the entry applies to*/
  174. };
  175.  
  176. typedef struct KernEntry KernEntry;
  177.  
  178. struct KernTable {
  179.  short numKerns;        /*number of kerning entries*/
  180. };
  181.  
  182. typedef struct KernTable KernTable;
  183.  
  184. struct WidthTable {
  185.  Fixed tabData[256];    /*character widths*/
  186.  Handle tabFont;        /*font record used to build table*/
  187.  long sExtra;            /*space extra used for table*/
  188.  long style;            /*extra due to style*/
  189.  short fID;                /*font family ID*/
  190.  short fSize;            /*font size request*/
  191.  short face;            /*style (face) request*/
  192.  short device;            /*device requested*/
  193.  Point inNumer;            /*scale factors requested*/
  194.  Point inDenom;            /*scale factors requested*/
  195.  short aFID;            /*actual font family ID for table*/
  196.  Handle fHand;            /*family record used to build up table*/
  197.  Boolean usedFam;        /*used fixed point family widths*/
  198.  unsigned char aFace;    /*actual face produced*/
  199.  short vOutput;            /*vertical scale output value*/
  200.  short hOutput;            /*horizontal scale output value*/
  201.  short vFactor;            /*vertical scale output value*/
  202.  short hFactor;            /*horizontal scale output value*/
  203.  short aSize;            /*actual size of actual font used*/
  204.  short tabSize;            /*total size of table*/
  205. };
  206.  
  207. typedef struct WidthTable WidthTable;
  208.  
  209. struct FamRec {
  210.  short ffFlags;            /*flags for family*/
  211.  short ffFamID;            /*family ID number*/
  212.  short ffFirstChar;        /*ASCII code of 1st character*/
  213.  short ffLastChar;        /*ASCII code of last character*/
  214.  short ffAscent;        /*maximum ascent for 1pt font*/
  215.  short ffDescent;        /*maximum descent for 1pt font*/
  216.  short ffLeading;        /*maximum leading for 1pt font*/
  217.  short ffWidMax;        /*maximum widMax for 1pt font*/
  218.  long ffWTabOff;        /*offset to width table*/
  219.  long ffKernOff;        /*offset to kerning table*/
  220.  long ffStylOff;        /*offset to style mapping table*/
  221.  short ffProperty[9];    /*style property info*/
  222.  short ffIntl[2];        /*for international use*/
  223.  short ffVersion;        /*version number*/
  224. };
  225.  
  226. typedef struct FamRec FamRec;
  227.  
  228.  
  229. #ifdef __cplusplus
  230. extern "C" {
  231. #endif
  232. pascal void InitFonts(void)
  233.  = 0xA8FE; 
  234. pascal void GetFontName(short familyID,Str255 name)
  235.  = 0xA8FF; 
  236. pascal void GetFNum(ConstStr255Param name,short *familyID)
  237.  = 0xA900; 
  238. pascal Boolean RealFont(short fontNum,short size)
  239.  = 0xA902; 
  240. pascal void SetFontLock(Boolean lockFlag)
  241.  = 0xA903; 
  242. pascal FMOutPtr FMSwapFont(const FMInput *inRec)
  243.  = 0xA901; 
  244. pascal void SetFScaleDisable(Boolean fscaleDisable)
  245.  = 0xA834; 
  246. pascal void FontMetrics(const FMetricRec *theMetrics)
  247.  = 0xA835; 
  248. pascal void SetFractEnable(Boolean fractEnable); 
  249. pascal Boolean IsOutline(Point numer,Point denom)
  250.  = {0x7000,0xA854}; 
  251. pascal void SetOutlinePreferred(Boolean outlinePreferred)
  252.  = {0x7001,0xA854}; 
  253. pascal Boolean GetOutlinePreferred(void)
  254.  = {0x7009,0xA854}; 
  255. pascal OSErr OutlineMetrics(short byteCount,const void *textPtr,Point numer,
  256.  Point denom,short *yMax,short *yMin,FixedPtr awArray,FixedPtr lsbArray,
  257.  RectPtr boundsArray)
  258.  = {0x7008,0xA854}; 
  259. pascal void SetPreserveGlyph(Boolean preserveGlyph)
  260.  = {0x700A,0xA854}; 
  261. pascal Boolean GetPreserveGlyph(void)
  262.  = {0x700B,0xA854}; 
  263. pascal OSErr FlushFonts(void)
  264.  = {0x700C,0xA854}; 
  265. void getfnum(char *theName,short *familyID); 
  266. void getfontname(short familyID,char *theName); 
  267. #ifdef __cplusplus
  268. }
  269. #endif
  270.  
  271. #endif
  272.